import type { App } from 'vue'
import {
  ElButton,
  ElInput,
  ElForm,
  ElFormItem,
  ElMenu,
  ElMenuItem,
  ElMenuItemGroup,
  ElSubMenu,
  ElIcon,
  ElTooltip,
  ElDropdown,
  ElDropdownMenu,
  ElDropdownItem,
  ElBreadcrumb,
  ElBreadcrumbItem,
  ElScrollbar,
  ElAvatar,
  ElPagination,
  ElDrawer,
  ElDialog
  // ElConfigProvider
} from 'element-plus'
import 'element-plus/dist/index.css'
import { msgTip, msgBoxTip } from '../custom/messageTip'

const components = [
  ElButton,
  ElInput,
  ElForm,
  ElFormItem,
  ElMenu,
  ElMenuItem,
  ElMenuItemGroup,
  ElSubMenu,
  ElIcon,
  ElTooltip,
  ElDropdown,
  ElDropdownMenu,
  ElDropdownItem,
  ElBreadcrumb,
  ElBreadcrumbItem,
  ElScrollbar,
  ElAvatar,
  ElPagination,
  ElDrawer,
  ElDialog
  // ElConfigProvider
]

const ElInputProps = ElInput.props
ElInputProps.clearable = { type: Boolean, default: true }
ElInputProps.maxlength = { type: Number, default: 50 }

export function setup(app: App) {
  for (const component of components) {
    app.component(component.name as string, component)
  }
  if (window) {
    window.$msgTip = msgTip
    window.$msgBoxTip = msgBoxTip
  }
}
